<%
## Tangent, an online sign-up sheet
## Copyright (C) 2008 Justin Ludwig and Adam Stuenkel
## 
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
## 
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
## 
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301, USA.
-%>

<% @page_title = "My Stuff" %>

<h1>My Stuff</h1>
<p>These are the activities to which I've signed up, and the events I coordinate.</p>

<table class="tbl">
<caption>My Upcoming Activities</caption>
<thead>
  <tr>
    <th><%= link_to_order_by "Event", "events.name" %></th>
    <th><%= link_to_order_by "Activity", "activities.name" %></th>
    <th>Tags</th>
    <th><%= link_to_order_by "Start", "start_date" %></th>
    <th><%= link_to_order_by "End", "end_date" %></th>
  </tr>
</thead>
<tbody>
<% for activity in @activities %>
  <tr class="<%= cycle("", "alt") -%>">
    <td><%= link_to h(activity.event.name), activity.event %></td>
    <td><%= link_to h(activity.name), activity %></td>
    <td><%=h activity.tag_list %></td>
    <td><%= list_datetime (activity.start_date || activity.event.start_date) %></td>
    <td><%= list_datetime (activity.end_date || activity.event.end_date) %></td>
  </tr>
<% end %>
</table>
<%= links_to_page @activities %>

<div class="tbl-foot">
	<%= link_to "My Past Activities", "/my/activities/past" %>
</div>

<table class="tbl">
<caption>My Upcoming Events</caption>
<thead>
  <tr>
    <th><%= link_to_order_by "Name", "events.name" %></th>
    <th>Tags</th>
    <th><%= link_to_order_by "Start", "start_date" %></th>
    <th><%= link_to_order_by "End", "end_date" %></th>
	<th class="tools">&nbsp;</th>
  </tr>
</thead>
<tbody>
<% for event in @events %>
  <tr class="<%= cycle("", "alt") -%>">
    <td><%= link_to h(event.name), event %></td>
    <td><%=h event.tag_list %></td>
    <td><%= list_datetime event.start_date %></td>
    <td><%= list_datetime event.end_date %></td>
    <td class="tools">
      <%= link_to titled_image_tag("silk/page_edit.png", :alt => "Edit"), edit_event_path(event) %>
	  <%= link_to_delete event %>
    </td>
  </tr>
<% end %>
</table>
<%= links_to_page @events %>

<div class="tbl-foot">
<div class="lr-container">
<span class="l">
	<%= link_to "My Past Events", my_events_past_path %>
</span>
<span class="r">
	<%= styled_button_to "New Event", new_event_path %>
</span>
</div>
</div>
